package com.cn.jinl.controller;


import com.cn.jinl.api.ILineOtherService;
import com.cn.jinl.domain.LineOther;
import com.cn.jinl.utils.CommonUtil;
import com.cn.jinl.utils.JsonResponse;
import com.cn.jinl.utils.QueryForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/lineOther")
public class LineOtherController {

    @Autowired
    private ILineOtherService lineOtherService;

    @RequestMapping("/getLineOtherList/{frontToken}")
    @ResponseBody
    public JsonResponse<Map<String,Object>> getLineOtherList(QueryForm queryForm, @PathVariable(value = "frontToken",required = true) String frontToken) throws Exception {
        JsonResponse<Map<String,Object>> response = new JsonResponse<Map<String,Object>>();
        Map<String,Object> maps  = lineOtherService.getLineOtherList(queryForm);
        response.setResult(maps);
        response.setSuccess(true);
        return  response;
    }

    @ResponseBody
    @RequestMapping("/updateLineOther/{frontToken}")
    public JsonResponse<String> updateLineOther(LineOther lineOther, @PathVariable(value = "frontToken",required = true) String frontToken) throws Exception {
        JsonResponse<String> response = new JsonResponse<String>();
        String result = lineOtherService.updateLineOther(lineOther);
        return CommonUtil.getResponseData(response,result);
    }

}
